#!/bin/sh

if [ -n "$1" ]
then
	echo "sh get params $1"
	mjpg_res=$(ps -e | grep -a "mjpg_streamer")
	echo $mjpg_res
	dev_res=${mjpg_res% $1*}
	echo $dev_res
	extra_res=${dev_res% root*}
	echo $extra_res
	pid_res=${extra_res##* }
	echo $pid_res
	kill -9 $pid_res
	if [ $? -eq 0 ]
	then
		echo "sh camera $1 mjpg_streamer stop success"
	else
		"sh camera $1 mjpg_streamer stop failed"
		exit 1
	fi
else
    echo "sh get null params"
	exit 1
fi
